﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace RestoreHandler
{
    class IECacheNormal
    {
        #region LoadFiles
        private FileInfo[] Load()
        {
            string dirPath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
            DirectoryInfo dir = new DirectoryInfo(dirPath);
            return dir.GetFiles(String.Format("p{0}[*].mp3",), SearchOption.AllDirectories);
        }
        #endregion

        #region CopyFiles
        private void Copy()
        {
            FileInfo[] files = Load();
            DirectoryInfo dir = Directory.CreateDirectory("TestMusicDownload");
            foreach (FileInfo info in files)
            {
                try
                {
                    String fullName = info.FullName;
                    String name = info.Name;
                    File.Copy(fullName, Path.Combine(dir.Name, name), true);
                }
                catch(Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
        #endregion
    }
}
